﻿/*------------------------------------------------
// File Description: LockRecord DataBase Entity
// Author:			 Crane
// Create Time:		 2020-11-11 09:36:43
//------------------------------------------------*/

using System;
using System.Data.Entity;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace IOA.MES.DataAccess.Entity
{
    /// <summary>
    /// 锁定记录
    /// </summary>
    [Table(nameof(LockRecord))]
    public class LockRecord : BaseEntity
    {
        private string _orderNo = string.Empty;
        private string _workOrderNo = string.Empty;
        private string _workshopCode = string.Empty;
        private string _workshopName = string.Empty;
        private string _barCode = string.Empty;
        private string _productCode = string.Empty;
        private string _productName = string.Empty;
        private string _productSpecs = string.Empty;
        private string _lockedReason = string.Empty;
        private string _unLockedReason = string.Empty;

        #region Public Property

        ///<Summary>
        /// 订单号
        ///</Summary>
        public string OrderNo
        {
            get { return string.IsNullOrWhiteSpace(_orderNo) ? string.Empty : _orderNo; }
            set { _orderNo = value; }
        }

        ///<Summary>
        /// 工单号
        ///</Summary>
        public string WorkOrderNo
        {
            get { return string.IsNullOrWhiteSpace(_workOrderNo) ? string.Empty : _workOrderNo; }
            set { _workOrderNo = value; }
        }

        ///<Summary>
        /// 车间代码
        ///</Summary>
        public string WorkshopCode
        {
            get { return string.IsNullOrWhiteSpace(_workshopCode) ? string.Empty : _workshopCode; }
            set { _workshopCode = value; }
        }

        ///<Summary>
        /// 车间名称
        ///</Summary>
        public string WorkshopName
        {
            get { return string.IsNullOrWhiteSpace(_workshopName) ? string.Empty : _workshopName; }
            set { _workshopName = value; }
        }

        ///<Summary>
        /// 组件条码
        ///</Summary>
        public string BarCode
        {
            get { return string.IsNullOrWhiteSpace(_barCode) ? string.Empty : _barCode; }
            set { _barCode = value; }
        }

        ///<Summary>
        /// 料号
        ///</Summary>
        public string ProductCode
        {
            get { return string.IsNullOrWhiteSpace(_productCode) ? string.Empty : _productCode; }
            set { _productCode = value; }
        }

        ///<Summary>
        /// 物料名称
        ///</Summary>
        public string ProductName
        {
            get { return string.IsNullOrWhiteSpace(_productName) ? string.Empty : _productName; }
            set { _productName = value; }
        }

        ///<Summary>
        /// 物料规格
        ///</Summary>
        public string ProductSpecs
        {
            get { return string.IsNullOrWhiteSpace(_productSpecs) ? string.Empty : _productSpecs; }
            set { _productSpecs = value; }
        }

        ///<Summary>
        /// 当前站点
        ///</Summary>
        public Enum.SiteType CurSite { get; set; }

        ///<Summary>
        /// 锁定站点
        ///</Summary>
        public Enum.SiteType LockSite { get; set; }

        ///<Summary>
        /// 锁定人
        ///</Summary>
        public int LockedBy { get; set; }

        ///<Summary>
        /// 锁定时间
        ///</Summary>
        public DateTime LockedTime { get; set; }

        ///<Summary>
        /// 锁定原因
        ///</Summary>
        public string LockedReason
        {
            get { return string.IsNullOrWhiteSpace(_lockedReason) ? string.Empty : _lockedReason; }
            set { _lockedReason = value; }
        }

        ///<Summary>
        /// 解锁人
        ///</Summary>
        public int UnLockedBy { get; set; }

        ///<Summary>
        /// 解锁时间
        ///</Summary>
        public DateTime? UnLockedTime { get; set; }

        ///<Summary>
        /// 解锁原因
        ///</Summary>
        public string UnLockedReason
        {
            get { return string.IsNullOrWhiteSpace(_unLockedReason) ? string.Empty : _unLockedReason; }
            set { _unLockedReason = value; }
        }
        #endregion
    }

    public partial class MESContext
    {
        /// <summary>
        /// 
        /// </summary>
        public virtual DbSet<LockRecord> LockRecords { get; set; }
    }
}